<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
		<meta charset="utf-8" />
		<meta name="keywords" content="pinpin社保" />
		<meta name="description" content="pinpin社保" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
        <meta name="renderer" content="webkit" />
        <meta name="viewport" content="width=device-width, initial-scale=1">
		<title>社保运营后台-现金券管理</title>
	<%@ include file="/WEB-INF/jsp/common/common.jsp" %>
</head>
<body>
	<div id="wrapper">
		<%@ include file="common/menu.jsp" %>
        <div id="page-wrapper">
            <div class="row">
            	<div class="col-lg-12">
            		<div class="panel panel-default">
            			<div class="panel-body">
            				<ul class="nav nav-tabs">
                                <li class="${coupon ? 'active' : '' }">
                                	<a href="#coupon" data-toggle="tab" onclick="javascript:tabSwitch(0)">现金券</a>
                                </li>
                                <li class="${coupon_channel ? 'active' : '' }">
                                	<a href="#coupon_channel" data-toggle="tab" onclick="javascript:tabSwitch(1)">领券渠道</a>
                                </li>
                                <li class="${coupon_link ? 'active' : '' }">
                                	<a href="#coupon_link" data-toggle="tab" onclick="javascript:tabSwitch(2)">链接</a>
                                </li>
                            </ul>
                            <div class="tab-content">
                                <div class="tab-pane fade in ${coupon ? 'active' : '' }" id="coupon">
                                	<c:if test="${coupon }">
        			    			<div class="form-inline dt-bootstrap no-footer">
		        			    		<!-- 表单查询 -->
		        			    		<div class="row">
		        			    			<div class="col-lg-12">
		        			    			<form action="${new_uri }" method="post" class="form-check">
		        			    				<label class="checkbox-inline">
		                                        <input type="text" class="form-control" name="name" id="name" placeholder="请输入现金券名称" >
		                                        </label>
		                                        <label class="checkbox-inline">
		                                        <select class="form-control" name="status" id="status">
		                                            <option value="">请选择现金券状态</option>
		                                            <option value="0" >下线</option>
		                                            <option value="1" >上线</option>
		                                        </select>
		                                        </label>
		                                        <label class="checkbox-inline">
		                                        <select class="form-control" name="type" id="type" onchange="checkType()">
		                                            <option value="">请选择现金券类型</option>
		                                            <option value="1" >月数有效券</option>
		                                            <option value="2" >固定期限券</option>
		                                            <option value="3" >满额抵扣券</option>
		                                        </select>
		                                        </label>
		                                        <label class="checkbox-inline">
		                                        <select class="form-control" name="month_limit" id="month_limit" style="display:none">
		                                            <option value="">请选择有效月数</option>
		                                            <c:forEach begin="1" step="1" end="12" var="month">
		                                            <option value="${month }" >${month }个月</option>
		                                            </c:forEach>
		                                        </select>
		                                        </label>
		                                        <label class="checkbox-inline">
		                                        <input type="text" class="form-control" name="price" id="price" placeholder="请输入现金券面值金额" >
		                                        </label>
		                                        <label class="checkbox-inline">
		                                        <input type="text" class="form-control" name="init_number" id="init_number" placeholder="请输入初始化数量" >
		                                        </label>
		                                        <label class="checkbox-inline">
		                                        <input type="text" class="form-control" name="person_limit" id="person_limit" placeholder="请输入单用户领取限额" >
		                                        </label>
		                                        <label class="checkbox-inline">
		                                        <input type="text" class="form-control" name="start_date" id="start_date" placeholder="请输入开始时间" onClick="WdatePicker({dateFmt:'yyyy-MM-dd',minDate:'2016-01-01'})" >
		                                        </label>
		                                        <label class="checkbox-inline">
		                                        <input type="text" class="form-control" name="end_date" id="end_date" placeholder="请输入结束时间" onClick="WdatePicker({dateFmt:'yyyy-MM-dd',minDate:'2016-01-01'})" >
		                                        </label>
		                                        <label class="checkbox-inline">
		                                        <input type="text" class="form-control" name="description" placeholder="请输入描述" >
		        			    			    </label>
		                                        <label class="checkbox-inline">
		        			    			    <input type="hidden" name="pageNo" value="${pageNo }">
		        			    			    </label>
		                                        <label class="checkbox-inline">
		        			    			    <input type="submit" class="btn btn-primary" value="添加现金券" onclick="return checkForm()">
		        			    			    </label>
		        			    			    </form>
		        			    			</div>
		        			    		</div><hr>
		        			    		<!-- 表单查询 -->
		        			    		<div class="row">
		        			    			<div class="col-lg-12">
		        			    			<form action="" method="get" id="queryCouponForm" class="form-check">
		                                        <label class="checkbox-inline">
		                                        <input type="text" class="form-control" name="name" placeholder="请输入现金券名称" value="${couponQueryForm.name }">
		        			    			    </label>
		                                        <label class="checkbox-inline">
		                                        <select class="form-control" name="status">
		                                            <option value="">请选择现金券状态</option>
		                                            <option value="0" <c:if test="${couponQueryForm.status eq 0 }">selected="selected"</c:if>>下线</option>
		                                            <option value="1" <c:if test="${couponQueryForm.status eq 1 }">selected="selected"</c:if>>上线</option>
		                                        </select>
		                                        </label>
		                                        <label class="checkbox-inline">
		                                        <select class="form-control" name="type">
		                                            <option value="">请选择现金券类型</option>
		                                            <option value="1" <c:if test="${couponQueryForm.type eq 1 }">selected="selected"</c:if>>月数有效券</option>
		                                            <option value="2" <c:if test="${couponQueryForm.type eq 2 }">selected="selected"</c:if>>固定期限券</option>
		                                            <option value="3" <c:if test="${couponQueryForm.type eq 3 }">selected="selected"</c:if>>满额抵扣券</option>
		                                        </select>
		                                        </label>
		                                        <label class="checkbox-inline">
		                                        <select class="form-control" name="month_limit">
		                                            <option value="">请选择有效月数</option>
		                                            <c:forEach begin="1" step="1" end="12" var="month">
		                                            <option value="${month }" <c:if test="${couponQueryForm.month_limit eq month }">selected="selected"</c:if>>${month }个月</option>
		                                            </c:forEach>
		                                        </select>
		        			    			    </label>
		                                        <label class="checkbox-inline">
		                                        <input type="text" class="form-control" name="price" placeholder="请输入现金券面值金额"  value="${couponQueryForm.price }">
		                                        </label>
		                                        <label class="checkbox-inline">
		                                        <input type="text" class="form-control" name="init_number" placeholder="请输入初始化数量"  value="${couponQueryForm.init_number }">
		                                        </label>
		                                        <label class="checkbox-inline">
		                                        <input type="text" class="form-control" name="start_date" id="start_date" placeholder="请输入开始时间" onClick="WdatePicker({dateFmt:'yyyy-MM-dd',minDate:'2016-01-01'})" value="${couponQueryForm.start_date }">
		                                        </label>
		                                        <label class="checkbox-inline">
		                                        <input type="text" class="form-control" name="end_date" id="end_date" placeholder="请输入结束时间" onClick="WdatePicker({dateFmt:'yyyy-MM-dd',minDate:'2016-01-01'})" value="${couponQueryForm.end_date }">
		        			    			    </label>
		                                        <label class="checkbox-inline">
		                                        <input type="hidden" name="pageNo" value="${pageNo }">
		        			    			    </label>
		                                        <label class="checkbox-inline">
		        			    			    <input type="submit" class="btn btn-primary" value="查 询">
		        			    			    </label>
		                                        <label class="checkbox-inline">
		                                        <button type="button" class="btn btn-primary" onclick="resetForm()">重置</button>
		        			    			    </label>
		                                        </form>
		        			    			</div>
		        			    		</div>
		        			    		<hr />
		        			    		<!-- 分页 -->
		        			    		<c:set var="page_link" value="?name=${couponQueryForm.name }&status=${couponQueryForm.status }&type=${couponQueryForm.type }&month_limit=${couponQueryForm.month_limit }&price=${couponQueryForm.price }&init_number=${couponQueryForm.init_number }&start_date=${couponQueryForm.start_date }&end_date=${couponQueryForm.end_date }&"></c:set>
		                            <c:set var="pre_disabled" value=""></c:set>
				    				<c:if test="${pageModel.pageNo le 1}">
				    					<c:set var="pre_disabled" value="disabled"></c:set>
				    				</c:if>
				    				<c:set var="next_disabled" value=""></c:set>
				    				<c:if test="${pageModel.pageNo ge pageModel.pageTotal}">
				    					<c:set var="next_disabled" value="disabled"></c:set>
				    				</c:if>
		                                <br/>
		        			    		<div class="row">
		        			    			<div class="col-lg-12">
		        			    			<form action="" method="get">
		        			    				<div class="ss-pagination">
		                                            <span class="ui-text-box">共${pageModel.totalRecord }条 ${pageModel.pageTotal }页</span>
		                                            <span class="ui-text-box">每页${pageModel.pageSize }条</span>
		                                            <span class="ui-text-box">当前第${pageModel.pageNo }页</span>
		        			    					<ul class="pagination">
		        			    						<li class="previous ${pre_disabled }" tabindex="0"><a href="${page_link }pageNo=${pageModel.previousPageNo }">上一页</a></li>
		        			    						<%@ include file="page_queue.jsp" %>
		        			    						<li class="next ${next_disabled }" tabindex="0"><a href="${page_link }pageNo=${pageModel.nextPageNo }">下一页</a></li>
		        			    					</ul>
		                                            <span>向第</span>
		                                            <input type="text" class="form-control" name="pageNo" size="3">
		                                            <span>页</span>
		                                            <input type="hidden" class="form-control" name="name" value="${couponQueryForm.name }">
		                                            <input type="hidden" class="form-control" name="status" value="${couponQueryForm.status }">
		                                            <input type="hidden" class="form-control" name="type" value="${couponQueryForm.type }">
		                                            <input type="hidden" class="form-control" name="month_limit" value="${couponQueryForm.month_limit }">
		                                            <input type="hidden" class="form-control" name="price" value="${couponQueryForm.price }">
		                                            <input type="hidden" class="form-control" name="init_number" value="${couponQueryForm.init_number }">
		                                            <input type="hidden" class="form-control" name="start_date" value="${couponQueryForm.start_date }">
		                                            <input type="hidden" class="form-control" name="end_date" value="${couponQueryForm.end_date }">
		                                            <button type="submit" class="btn btn-primary">跳转</button>
		        			    				</div>
		        			    				</form>
		        			    			</div>
		        			    		</div>
		        			    	
		        			    		<!-- 表格列表 -->
		        			    		<div class="row">
		        			    			<div class="col-lg-12">
		        			    				<table class="table table-striped table-bordered table-hover no-footer" role="grid">
		        			    					<thead>
		        			    						<tr><th width="65px"><label><input id="selectAll" type="checkbox" onclick="javascript:selectAll(this,'uids')">全选</label></th>
		                                                    <th>现金券ID</th>
		                                                    <th>现金券名称</th>
		                                                    <th>现金券状态</th>
		                                                    <th width="90">领券开始时间</th>
		                                                    <th width="90">领券结束时间</th>
		                                                    <th>现金券类型</th>
		                                                    <th width="150">创建时间</th>
		                                                    <th>描述</th>
		                                                    <th>现金券金额</th>
		                                                    <th>初始化数量</th>
		                                                    <th>已绑定数量</th>
		                                                    <th>已消费数量</th>
		                                                    <th>已发放数量</th>
		                                                    <th>领取限额</th>
		                                                    <th>有效月数</th>
		                                                    <th>操作</th>
		                                                </tr>
		        			    					</thead>
		        			    					<tbody>
		        			    					<c:choose>
		        			    						<c:when test="${empty pageModel.recordList }">
		        			    							没有找到相关记录啊
		        			    						</c:when>
		        			    						<c:otherwise>
															<c:forEach items="${pageModel.recordList }" var="coupon">
				        			    					<tr role="row">
				        			    							<td><input type="checkbox" name="uids"></td>
				                                                    <td>${coupon.id }</td>
				                                                    <td>${coupon.name }</td>
				                                                    <td>
				                                                    <c:if test="${coupon.status eq 0 }">下线</c:if>
				                                                    <c:if test="${coupon.status eq 1 }">上线</c:if>
				                                                    </td>
				                                                    <td>
				                                                    <fmt:formatDate value="${coupon.start_date }" pattern="yyyy-MM-dd"></fmt:formatDate>
				                                                    </td>
				                                                    <td>
				                                                    <fmt:formatDate value="${coupon.end_date }" pattern="yyyy-MM-dd"></fmt:formatDate>
				                                                    </td>
				                                                    <td>
				                                                    <c:if test="${coupon.type eq 1 }">月数有效券</c:if>
				                                                    <c:if test="${coupon.type eq 2 }">固定期限券</c:if>
				                                                    <c:if test="${coupon.type eq 3 }">满额抵扣券</c:if>
				                                                    </td>
				                                                    <td><fmt:formatDate value="${coupon.create_time }" pattern="yyyy-MM-dd HH:mm:ss"></fmt:formatDate></td>
				                                                    <td>${coupon.description }</td>
				                                                    <td>${coupon.price }</td>
				                                                    <td>${coupon.init_number }</td>
				                                                    <td>${coupon.bind_number }</td>
				                                                    <td>${coupon.used_number }</td>
				                                                    <td>${coupon.send_number }</td>
				                                                    <td>${coupon.person_limit }</td>
				                                                    <td>
				                                                    <c:if test="${coupon.type eq 1 }">${coupon.month_limit }个月</c:if>
				                                                    </td>
				                                                    <td>
				                                                    <c:if test="${coupon.status eq 0 }"><button class="btn btn-primary btn-sm" onclick="javascript:window.location.href='${edit_status_uri }?coupon_id=${coupon.id}&status=1&pageNo=${couponQueryForm.pageNo }';">上线</button></c:if>
				                                                     <c:if test="${coupon.status eq 1 }"><button class="btn btn-primary btn-sm" onclick="javascript:window.location.href='${edit_status_uri }?coupon_id=${coupon.id}&status=0&pageNo=${couponQueryForm.pageNo }';">下线</button></c:if>
				                                                     <br /><br />
				                                                     <button class="btn btn-primary btn-sm" onclick="javascript:window.location.href='${coupon_user_list_uri }?coupon_id=${coupon.id}';">查看用户</button>
				                                                     <br /><br />
				                                                     <button class="btn btn-primary btn-sm" onclick="javascript:window.location.href='${channel_tobind_uri }?coupon_id=${coupon.id}';">领券渠道</button>
				                                                    </td>
				        			    						</tr>
				        			    					</c:forEach>
		        			    						</c:otherwise>
		        			    					</c:choose>
		        			    					
		        			    					</tbody>
		        			    				</table>
		        			    			</div>
		        			    		</div>
		        			    		<hr />
		        			    		<!-- 分页 -->
		                                <br/>
		        			    		<div class="row">
		        			    			<div class="col-lg-12">
		        			    			<form action="" method="get">
		        			    				<div class="ss-pagination">
		                                            <span class="ui-text-box">共${pageModel.totalRecord }条 ${pageModel.pageTotal }页</span>
		                                            <span class="ui-text-box">每页${pageModel.pageSize }条</span>
		                                            <span class="ui-text-box">当前第${pageModel.pageNo }页</span>
		        			    					<ul class="pagination">
		        			    						<li class="previous ${pre_disabled }" tabindex="0"><a href="${page_link }pageNo=${pageModel.previousPageNo }">上一页</a></li>
		        			    						<%@ include file="page_queue.jsp" %>
		        			    						<li class="next ${next_disabled }" tabindex="0"><a href="${page_link }pageNo=${pageModel.nextPageNo }">下一页</a></li>
		        			    					</ul>
		        			    					
		                                            <span>向第</span>
		                                            <input type="text" class="form-control" name="pageNo" size="3">
		                                            <span>页</span>
		                                            <input type="hidden" class="form-control" name="name" value="${couponQueryForm.name }">
		                                            <input type="hidden" class="form-control" name="status" value="${couponQueryForm.status }">
		                                            <input type="hidden" class="form-control" name="type" value="${couponQueryForm.type }">
		                                            <input type="hidden" class="form-control" name="month_limit" value="${couponQueryForm.month_limit }">
		                                            <input type="hidden" class="form-control" name="price" value="${couponQueryForm.price }">
		                                            <input type="hidden" class="form-control" name="init_number" value="${couponQueryForm.init_number }">
		                                            <input type="hidden" class="form-control" name="start_date" value="${couponQueryForm.start_date }">
		                                            <input type="hidden" class="form-control" name="end_date" value="${couponQueryForm.end_date }">
		                                            <button type="submit" class="btn btn-primary">跳转</button>
		        			    				</div>
		        			    				</form>
		        			    			</div>
		        			    		</div>
		        			    	</div>
		        			    	</c:if>
		            			</div>	<!-- tab-pane  -->
		            			<div class="tab-pane fade in ${coupon_channel ? 'active' : '' }" id="coupon_channel">
		        			    	<c:if test="${coupon_channel }">
		        			    	<div class="form-inline dt-bootstrap no-footer">
		        			    		<!-- 表单查询 -->
		        			    		<div class="row">
		        			    			<div class="col-lg-12">
		        			    			<form action="${channel_new_uri }" method="post">
		                                        <input type="text" class="form-control" name="name" placeholder="请输入领券渠道名称" >
		        			    			    <input type="submit" class="btn btn-primary" value="添加领券渠道">
		        			    			    </form>
		        			    			</div>
		        			    		</div>
		        			    		
		        			    		<!-- 表单查询 -->
		        			    		<div class="row">
		        			    			<div class="col-lg-12">
		        			    			<form action="${coupon_channel_list_uri}" method="get" id="queryCouponChannelForm">
		                                        <input type="text" class="form-control" name="name" placeholder="请输入领券渠道名称" value="${couponChannelQueryForm.name }">
		        			    			    <input type="hidden" name="pageNo" value="${pageNo }">
		        			    			    <input type="submit" class="btn btn-primary" value="查 询">
		        			    			    <button type="button" class="btn btn-primary" onclick="resetForm()">重置</button>
		        			    			    </form>
		        			    			</div>
		        			    		</div>
		        			    		<hr />
		        			    		<!-- 分页 -->
		        			    		<c:set var="page_link" value="${coupon_channel_list_uri}?name=${couponChannelQueryForm.name }&"></c:set>
		                            <c:set var="pre_disabled" value=""></c:set>
				    				<c:if test="${pageModel.pageNo le 1}">
				    					<c:set var="pre_disabled" value="disabled"></c:set>
				    				</c:if>
				    				<c:set var="next_disabled" value=""></c:set>
				    				<c:if test="${pageModel.pageNo ge pageModel.pageTotal}">
				    					<c:set var="next_disabled" value="disabled"></c:set>
				    				</c:if>
		                                <br/>
		        			    		<div class="row">
		        			    			<div class="col-lg-12">
		        			    			<form action="${coupon_channel_list_uri}" method="get">
		        			    				<div class="ss-pagination">
		                                            <span class="ui-text-box">共${pageModel.totalRecord }条 ${pageModel.pageTotal }页</span>
		                                            <span class="ui-text-box">每页${pageModel.pageSize }条</span>
		                                            <span class="ui-text-box">当前第${pageModel.pageNo }页</span>
		        			    					<ul class="pagination">
		        			    						<li class="previous ${pre_disabled }" tabindex="0"><a href="${page_link }pageNo=${pageModel.previousPageNo }">上一页</a></li>
		        			    						<%@ include file="page_queue.jsp" %>
		        			    						<li class="next ${next_disabled }" tabindex="0"><a href="${page_link }pageNo=${pageModel.nextPageNo }">下一页</a></li>
		        			    					</ul>
		                                            <span>向第</span>
		                                            <input type="text" class="form-control" name="pageNo" size="3">
		                                            <input type="hidden" class="form-control" name="name" value="${couponChannelQueryForm.name }">
		                                            <span>页</span>
		                                            <button type="submit" class="btn btn-primary">跳转</button>
		        			    				</div>
		        			    				</form>
		        			    			</div>
		        			    		</div>
		        			    	
		        			    		<!-- 表格列表 -->
		        			    		<div class="row">
		        			    			<div class="col-lg-12">
		        			    				<table class="table table-striped table-bordered table-hover no-footer" role="grid">
		        			    					<thead>
		        			    						<tr><th width="65px"><label><input id="selectAll" type="checkbox" onclick="javascript:selectAll(this,'uids')">全选</label></th>
		                                                    <th>领券渠道编号</th>
		                                                    <th>领券渠道名称</th>
		                                                </tr>
		        			    					</thead>
		        			    					<tbody>
		        			    					<c:choose>
		        			    						<c:when test="${empty pageModel.recordList }">
		        			    							没有找到相关记录啊
		        			    						</c:when>
		        			    						<c:otherwise>
															<c:forEach items="${pageModel.recordList }" var="couponname">
				        			    					<tr role="row">
				        			    							<td><input type="checkbox" name="uids"></td>
				                                                    <td>${couponname.id }</td>
				                                                    <td>${couponname.name }</td>
				        			    						</tr>
				        			    					</c:forEach>
		        			    						</c:otherwise>
		        			    					</c:choose>
		        			    					
		        			    					</tbody>
		        			    				</table>
		        			    			</div>
		        			    		</div>
		        			    		<hr />
		        			    		<!-- 分页 -->
		                                <br/>
		        			    		<div class="row">
		        			    			<div class="col-lg-12">
		        			    			<form action="${coupon_channel_list_uri}" method="get">
		        			    				<div class="ss-pagination">
		                                            <span class="ui-text-box">共${pageModel.totalRecord }条 ${pageModel.pageTotal }页</span>
		                                            <span class="ui-text-box">每页${pageModel.pageSize }条</span>
		                                            <span class="ui-text-box">当前第${pageModel.pageNo }页</span>
		        			    					<ul class="pagination">
		        			    						<li class="previous ${pre_disabled }" tabindex="0"><a href="${page_link }pageNo=${pageModel.previousPageNo }">上一页</a></li>
		        			    						<%@ include file="page_queue.jsp" %>
		        			    						<li class="next ${next_disabled }" tabindex="0"><a href="${page_link }pageNo=${pageModel.nextPageNo }">下一页</a></li>
		        			    					</ul>
		        			    					
		                                            <span>向第</span>
		                                            <input type="text" class="form-control" name="pageNo" size="3">
		                                            <input type="hidden" class="form-control" name="name" value="${couponChannelQueryForm.name }">
		                                            <span>页</span>
		                                            <button type="submit" class="btn btn-primary">跳转</button>
		        			    				</div>
		        			    				</form>
		        			    			</div>
		        			    		</div>
		        			    	</div>
		        			    	</c:if>
		            			</div>
		            			<div class="tab-pane fade in  ${coupon_link ? 'active' : '' }" id="coupon_link">
		            			<c:if test="${coupon_link }">
		        			    	<div class="form-inline dt-bootstrap no-footer">
		        			    		<!-- 表单查询 -->
		        			    		<div class="row">
		        			    			<div class="col-lg-12">
		        			    			<form action="${new_link_uri}" method="post">
		                                        <input type="text" class="form-control" name="url" id="url" placeholder="请输入链接URL" >
		                                        <select class="form-control" name="type" id="type" onchange="checkType()">
		                                            <option value="">请选择链接类型</option>
		                                            <option value="1" >月数有效</option>
		                                            <option value="2" >固定期限</option>
		                                            <option value="0" >不定期限</option>
		                                        </select>
		                                        <select class="form-control" name="purpose" id="purpose">
		                                            <option value="">请选择链接用途</option>
		                                            <option value="1" >APP请求现金券链接</option>
		                                            <!-- <option value="2" >用户分享现金券</option> -->
		                                            <option value="3" >渠道推广</option>
		                                            <option value="4" >APP首页图片</option>
		                                            <option value="0" >其它用途</option>
		                                        </select>
		                                        <input type="text" class="form-control" name="comment" id="comment" placeholder="请输入备注" >
		        			    			    <input type="submit" class="btn btn-primary" value="添加链接">
		        			    			    <select class="form-control" name="month_limit" id="month_limit" style="display:none">
		                                            <option value="">请选择有效月数</option>
		                                            <c:forEach begin="1" step="1" end="12" var="month">
		                                            <option value="${month }" >${month }个月</option>
		                                            </c:forEach>
		                                        </select>
		                                        <input type="text" class="form-control" style="display:none" name="end_date" id="end_date" placeholder="请输入有效时间" onClick="WdatePicker({dateFmt:'yyyy-MM-dd',minDate:'2016-01-01'})" >
		        			    			    </form>
		        			    			</div>
		        			    		</div>
		        			    		<hr />
		        			    		<!-- 表单查询 -->
		        			    		<div class="row">
		        			    			<div class="col-lg-12">
		        			    			<form action="${coupon_link_list_uri}" method="get" id="queryLinkForm">
		                                        <input type="text" class="form-control" name="url" placeholder="请输入链接URL" value="${linkQueryForm.url }">
		                                        <input type="text" class="form-control" name="code" placeholder="请输入链接码" value="${linkQueryForm.code }">
		                                        <input type="text" class="form-control" name="share_id" placeholder="请输入分享来源标识" value="${linkQueryForm.share_id }">
		                                        <select class="form-control" name="type">
		                                            <option value="">请选择链接类型</option>
		                                            <option value="1" <c:if test="${linkQueryForm.type eq 1 }">selected="selected"</c:if>>月数有效</option>
		                                            <option value="2" <c:if test="${linkQueryForm.type eq 2 }">selected="selected"</c:if>>固定期限</option>
		                                            <option value="0" <c:if test="${linkQueryForm.type eq 0 }">selected="selected"</c:if>>不定期限</option>
		                                        </select>
		                                        <select class="form-control" name="purpose">
		                                            <option value="">请选择链接用途</option>
		                                            <option value="1" <c:if test="${linkQueryForm.purpose eq 1 }">selected="selected"</c:if>>APP请求现金券链接</option>
		                                            <option value="2" <c:if test="${linkQueryForm.purpose eq 2 }">selected="selected"</c:if>>用户分享现金券</option>
		                                            <option value="3" <c:if test="${linkQueryForm.purpose eq 3 }">selected="selected"</c:if>>渠道推广</option>
		                                            <option value="4" <c:if test="${linkQueryForm.purpose eq 4 }">selected="selected"</c:if>>APP首页图片</option>
		                                            <option value="0" <c:if test="${linkQueryForm.purpose eq 0 }">selected="selected"</c:if>>其它用途</option>
		                                        </select>
		                                        <select class="form-control" name="month_limit">
		                                            <option value="">请选择有效月数</option>
		                                            <c:forEach begin="1" step="1" end="12" var="month">
		                                            <option value="${month }" >${month }个月</option>
		                                            </c:forEach>
		                                        </select>
		                                        <input type="text" class="form-control" name="end_date" placeholder="请输入有效时间" onClick="WdatePicker({dateFmt:'yyyy-MM-dd',minDate:'2016-01-01'})" >
		        			    			    
		        			    			    <input type="hidden" name="pageNo" value="${pageNo }">
		        			    			    <input type="submit" class="btn btn-primary" value="查 询">
		        			    			    <button type="button" class="btn btn-primary" onclick="resetForm()">重置</button>
		        			    			    </form>
		        			    			</div>
		        			    		</div>
		        			    		<hr />
		        			    		<!-- 分页 -->
		        			    		<c:set var="page_link" value="${coupon_link_list_uri}?url=${linkQueryForm.url }&code=${linkQueryForm.code }&share_id=${linkQueryForm.share_id }&type=${linkQueryForm.type }&purpose=${linkQueryForm.purpose }&month_limit=${linkQueryForm.month_limit }&end_date=${linkQueryForm.end_date }&"></c:set>
		                            <c:set var="pre_disabled" value=""></c:set>
				    				<c:if test="${pageModel.pageNo le 1}">
				    					<c:set var="pre_disabled" value="disabled"></c:set>
				    				</c:if>
				    				<c:set var="next_disabled" value=""></c:set>
				    				<c:if test="${pageModel.pageNo ge pageModel.pageTotal}">
				    					<c:set var="next_disabled" value="disabled"></c:set>
				    				</c:if>
		                                <br/>
		        			    		<div class="row">
		        			    			<div class="col-lg-12">
		        			    			<form action="${coupon_link_list_uri}" method="get">
		        			    				<div class="ss-pagination">
		                                            <span class="ui-text-box">共${pageModel.totalRecord }条 ${pageModel.pageTotal }页</span>
		                                            <span class="ui-text-box">每页${pageModel.pageSize }条</span>
		                                            <span class="ui-text-box">当前第${pageModel.pageNo }页</span>
		        			    					<ul class="pagination">
		        			    						<li class="previous ${pre_disabled }" tabindex="0"><a href="${page_link }pageNo=${pageModel.previousPageNo }">上一页</a></li>
		        			    						<%@ include file="page_queue.jsp" %>
		        			    						<li class="next ${next_disabled }" tabindex="0"><a href="${page_link }pageNo=${pageModel.nextPageNo }">下一页</a></li>
		        			    					</ul>
		                                            <span>向第</span>
		                                            <input type="text" class="form-control" name="pageNo" size="3">
		                                            <span>页</span>
		                                            <input type="hidden" class="form-control" name="url" value="${linkQueryForm.url }">
		                                        	<input type="hidden" class="form-control" name="code" value="${linkQueryForm.code }">
		                                        	<input type="hidden" class="form-control" name="share_id" value="${linkQueryForm.share_id }">
		                                        	<input type="hidden" class="form-control" name="type" value="${linkQueryForm.type }">
		                                        	<input type="hidden" class="form-control" name="purpose" value="${linkQueryForm.purpose }">
		                                        	<input type="hidden" class="form-control" name="month_limit" value="${linkQueryForm.month_limit }">
		                                        	<input type="hidden" class="form-control" name="end_date" value="${linkQueryForm.end_date }">
		                                            <button type="submit" class="btn btn-primary">跳转</button>
		        			    				</div>
		        			    				</form>
		        			    			</div>
		        			    		</div>
		        			    	
		        			    		<!-- 表格列表 -->
		        			    		<div class="row">
		        			    			<div class="col-lg-12">
		        			    				<table class="table table-striped table-bordered table-hover no-footer" role="grid">
		        			    					<thead>
		        			    						<tr><th width="65px"><label><input id="selectAll" type="checkbox" onclick="javascript:selectAll(this,'uids')">全选</label></th>
		                                                    <th>链接ID</th>
		                                                    <th>链接URL</th>
		                                                    <th>链接码</th>
		                                                    <th width="90">链接有效时间</th>
		                                                    <th>链接类型</th>
		                                                    <th>有效月数</th>
		                                                    <th width="150">创建时间</th>
		                                                    <th>链接用途</th>
		                                                    <th>分享来源标识</th>
		                                                    <th>分享使用上限</th>
		                                                    <th>备注信息</th>
		                                                    <th>点击次数</th>
		                                                    <th>验证链接</th>
		                                                </tr>
		        			    					</thead>
		        			    					<tbody>
		        			    					<c:choose>
		        			    						<c:when test="${empty pageModel.recordList }">
		        			    							没有找到相关记录啊
		        			    						</c:when>
		        			    						<c:otherwise>
															<c:forEach items="${pageModel.recordList }" var="link">
				        			    					<tr role="row">
				        			    							<td><input type="checkbox" name="uids"></td>
				                                                    <td>${link.id }</td>
				                                                    <td>${link.url }</td>
				                                                    <td>?code=${link.code }</td>
				                                                    <td>
				                                                    <fmt:formatDate value="${link.end_date }" pattern="yyyy-MM-dd"></fmt:formatDate>
				                                                    </td>
				                                                    <td>
				                                                    <c:if test="${link.type eq 1 }">月数有效</c:if>
				                                                    <c:if test="${link.type eq 2 }">固定期限</c:if>
				                                                    <c:if test="${link.type eq 0 }">不定期限</c:if>
				                                                    </td>
				                                                    <td>${link.month_limit }个月</td>
				                                                    <td><fmt:formatDate value="${link.create_time }" pattern="yyyy-MM-dd HH:mm:ss"></fmt:formatDate></td>
				                                                    <td>
				                                                    <c:if test="${link.purpose eq 1 }">APP请求现金券链接</c:if>
				                                                    <c:if test="${link.purpose eq 2 }">用户分享现金券</c:if>
				                                                    <c:if test="${link.purpose eq 3 }">渠道推广</c:if>
				                                                    <c:if test="${link.purpose eq 4 }">APP首页图片</c:if>
				                                                    <c:if test="${link.purpose eq 0 }">其它用途</c:if>
				                                                    </td>
				                                                    <td>${link.share_id }</td>
				                                                    <td>${link.share_limit }</td>
				                                                    <td>${link.comment }</td>
				                                                    <td>${link.count }</td>
				                                                    <td><a href="${link.url }?code=${link.code }" target="_blank">点击访问</a></td>
				        			    						</tr>
				        			    					</c:forEach>
		        			    						</c:otherwise>
		        			    					</c:choose>
		        			    					
		        			    					</tbody>
		        			    				</table>
		        			    			</div>
		        			    		</div>
		        			    		<hr />
		        			    		<!-- 分页 -->
		                                <br/>
		        			    		<div class="row">
		        			    			<div class="col-lg-12">
		        			    			<form action="${coupon_link_list_uri}" method="get">
		        			    				<div class="ss-pagination">
		                                            <span class="ui-text-box">共${pageModel.totalRecord }条 ${pageModel.pageTotal }页</span>
		                                            <span class="ui-text-box">每页${pageModel.pageSize }条</span>
		                                            <span class="ui-text-box">当前第${pageModel.pageNo }页</span>
		        			    					<ul class="pagination">
		        			    						<li class="previous ${pre_disabled }" tabindex="0"><a href="${page_link }pageNo=${pageModel.previousPageNo }">上一页</a></li>
		        			    						<%@ include file="page_queue.jsp" %>
		        			    						<li class="next ${next_disabled }" tabindex="0"><a href="${page_link }pageNo=${pageModel.nextPageNo }">下一页</a></li>
		        			    					</ul>
		        			    					
		                                            <span>向第</span>
		                                            <input type="text" class="form-control" name="pageNo" size="3">
		                                            <span>页</span>
		                                            <input type="hidden" class="form-control" name="url" value="${linkQueryForm.url }">
		                                        	<input type="hidden" class="form-control" name="code" value="${linkQueryForm.code }">
		                                        	<input type="hidden" class="form-control" name="share_id" value="${linkQueryForm.share_id }">
		                                        	<input type="hidden" class="form-control" name="type" value="${linkQueryForm.type }">
		                                        	<input type="hidden" class="form-control" name="purpose" value="${linkQueryForm.purpose }">
		                                        	<input type="hidden" class="form-control" name="month_limit" value="${linkQueryForm.month_limit }">
		                                        	<input type="hidden" class="form-control" name="end_date" value="${linkQueryForm.end_date }">
		                                            <button type="submit" class="btn btn-primary">跳转</button>
		        			    				</div>
		        			    				</form>
		        			    			</div>
		        			    		</div>
		        			    	</div>
		            			</c:if>
		            			</div>
		            		</div><!-- tab-content  -->
            			</div> 
            		</div>	
            	</div>
            </div>
        </div>
	</div>
</body>
<script type="text/javascript">
	function tabSwitch(index) {
		if (index == 0) {
			document.location.href="${coupon_list_uri}";
		} else if (index == 1) {
			document.location.href="${coupon_channel_list_uri}";
		} else if (index == 2) {
			document.location.href="${coupon_link_list_uri}";
		}
	}
	

	function resetForm() {
		$("#queryCouponForm").find("input[type=text],select").val("");
	}
	function selectAll(btn,items){
	  var selectAll=btn;
	  var nid_var=document.getElementsByName(items);
	  for(var i = 0; i < nid_var.length; i ++ ) {
		nid_var[i].checked = selectAll.checked;
		}
	}
	function checkType(){
		if($("#type").val() == 1) {
			$("#month_limit").css('display','block');
			$("#end_date").css('display','none');
		} else if($("#type").val() == 2) {
			$("#month_limit").css('display','none');
			$("#end_date").css('display','block');
		} else {
			$("#month_limit").css('display','none');
			$("#end_date").css('display','none');
		}

	}
	function checkForm(){
		if($("#name").val() == '') {
			alert("现金券名称不能为空");
			return false;
		}
		
		if($("#status").val() == '') {
			alert("请选择现金券状态");
			return false;
		}
		
		if($("#type").val() == '') {
			alert("请选择现金券类型");
			return false;
		} else {
			if($("#type").val() == 1) {
				if($("#month_limit").val() == '') {
					alert("请选择有效月数");
					return false;
				}
			} else if($("#type").val() == 2) {
				if($("#start_date").val() == '') {
					alert("请选择开始时间");
					return false;
				}
				if($("#end_date").val() == '') {
					alert("请选择结束时间");
					return false;
				}
			} else {
				alert("暂不支持此种类型");
				return false;
			}

		}
		
		if($("#price").val() == '') {
			alert("现金券面值金额不能为空");
			return false;
		} else {
			if(!$.isNumeric($("#price").val())){
				alert("金额只允许数字格式，请勿输入非数字！");
				return false;
			}
			if($("#price").val().indexOf('.')!=-1) {
				alert("现金券面值金额不能带小数点");
				return false;
			}
		}
		
		if($("#init_number").val() == '') {
			alert("初始化数量不能为空");
			return false;
		} else {
			if(!$.isNumeric($("#price").val())){
				alert("初始化数量只允许数字格式，请勿输入非数字！");
				return false;
			}
		}
		
		if($("#person_limit").val() == '') {
			alert("单用户领取限额不能为空");
			return false;
		} else {
			if(!$.isNumeric($("#person_limit").val())){
				alert("单用户领取限额只允许数字格式，请勿输入非数字！");
				return false;
			}
		}
		
	}
</script>
</html>